/****************************************************************
 * I am the AC 130 vs Pirate game. I allow the user to control an 
 * AC130 gunship in the hunt for Modern day pirates. The player  
 * will be allowed to roam free across a section of ocean/coastline.  
 * In the water there will be four types of vessels: Merchant  
 * ships that the player must protect, Pirate ships that the player  
 * must identify and destroy, Fishing boats that look like Pirate  
 * ships that the player must not destroy, and Friendly Navy ships  
 * that can capture pirates for extra points. Time permitting there  
 * may also be ground targets to attack. 
 *
 * Key elements of this project will be the Player/AC130, the Ships,  
 * the ShipAI system, the collision grid, the debris controller, the  
 * Ground/Water, Clouds, and scoring system. This project will make  
 * use of an external text file to store useful game parameters,  
 * thus allowing us to play balance the game without recompiling  
 * the executable. 
 *****************************************************************
 * I am the Ground class. I contain all the information to render
 *****************************************************************/

#include "Camera.h"
#include "GameData.h"
#include "CrashBin.h"
#include <allegro.h>

#define MAXTILE 256

#ifndef __GROUND_H__
#define __GROUND_H__

class Ground {
public:
		// external references
	GameData * gd;
	CrashBin * myCrashBin;
		// map data
	int tileW;
	int tileH;
	BITMAP * map;
			// draw data
	int waterR, waterG, waterB;

	int tileMax;
	BITMAP * tile[MAXTILE];
	BITMAP * border;
	bool isEdit;

public:
	Ground();
	~Ground();

	void Init(GameData * data, CrashBin * exCrashBin);
		// data retrieval
	int GetMapX(int worldX);
	int GetMapY(int worldY);
	int GetTile(int mapX, int mapY);
		// map edit
	int PickTile(int screenX, int screenY);
	void SetTile(int mapX, int mapY, int tileInd);
	void LoadMap(char * fname);
	void SaveMap(char * fname);
		// render
	void DrawWater( Camera * cam);
	void DrawGround( Camera * cam);
	void DrawTilePick( Camera * cam, int curTile);
	
};

#endif
